home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-11 / nan_s789.zip / S50008.TXT < prev    next >
Text File  |  1992-02-15  |  4KB  |  131 lines

  1. CLIPPER 5.0 SUPPORT BULLETIN #8
  2.  
  3. BULLETIN REVISED: 22nd Jan, 1992
  4.  
  5. PRODUCT: Clipper 5.0
  6.  
  7. AFFECTED VERSIONS: 5.01
  8.  
  9. SUBJECT: Solutions to Open Error (4)
  10.  
  11.  
  12. Open Error (4) means that not enough file handles were available
  13. for the operation being performed.  The following are some things
  14. to try in order to eliminate the problem.
  15.  
  16.  
  17. 1. Check the version of DOS you're using.  Versions of DOS lower
  18. than 3.3 allow a maximum of 20 file handles.  This figure can be
  19. increased by using a utility such as HANDLES.OBJ, which can be
  20. found on NANFORUM on CompuServe.
  21.  
  22. 2. Check the setting of the FILES parameter in your Config.Sys
  23. file, and increase it if necessary.
  24.  
  25. 3. Check the setting of the F parameter in your CLIPPER
  26. environment variable.  This should be the same as the setting of
  27. the FILES parameter in your Config.Sys file.  If you are using DOS
  28. 3.3, the F parameter should be set to an odd number.  Due to an
  29. anomaly in this version of the operating system, 64K of memory is
  30. wasted if an even number is used (see PC Tech Journal, April 1988,
  31. Page 162).
  32.  
  33. 4. If you're in a network environment, increase the number of
  34. file handles allocated to the workstation experiencing the error.
  35.  
  36. 5. If you're using DOS 4, the problem may be that the /F
  37. parameter of the SHARE command is not set to a large enough
  38. figure.  Try increasing it as follows: SHARE /F:10000    (bytes)
  39.  
  40.  
  41. ADDITIONAL NOTES
  42.  
  43. If the file server on a Novell network uses all its available file
  44. handles, requesting another handle will result in an Open Error
  45. (5) rather than Open Error (4).  If you experience an Open Error
  46. (5) and think this may be the cause, look at the statistics area
  47. of FCONSOLE.  You will see the maximum number of handles allowed,
  48. the maximum currently open, and most importantly, the maximum ever
  49. reached.
  50.  
  51.  
  52. The Virtual Memory Manager will use one file handle if it needs to
  53. write information to disk.  The Dynamic Overlay Manager uses two
  54. handles by default, and if static overlays are present, the Static
  55. Overlay Manager uses one handle.  If you're experiencing an Open
  56. Error (4), be sure to include these allocations when calculating
  57. the number of file handles your application is using.
  58.  
  59.  
  60. If you have insufficient control over your users' environments to
  61. stipulate the setting of the FILES parameter in Config.Sys, you
  62. may need to check the number of file handles available before
  63. opening a file.  This can be achieved by use of the following
  64. code:
  65.  
  66. /***
  67. *  Handles( nToCheck ) --> number of handles opened
  68. *  Function to check the number of file handles used.
  69. *  Copyright (c) 1990-1991 Nantucket Corp.  All rights reserved.
  70. *  Scott McIntosh
  71. *
  72. *  NOTE: Compile with /N /W /A
  73. *
  74. *  If a number is passed, this function tests to see if that
  75. *    number of files can be opened.
  76. *  If no number is passed, the function returns the maximum
  77. *    number of files that can be opened.
  78. */
  79.  
  80. FUNCTION Handles( nToCheck )
  81.  
  82.    LOCAL nOpened, nClosed, nHandle, aHandles := {}
  83.  
  84.    // If no parameter is passed, try to open all 250 handles
  85.    nToCheck := IF( nToCheck == NIL, 250, nToCheck )
  86.  
  87.    FOR nOpened := 1 TO nToCheck
  88.  
  89.       // Open the NUL device--it only fails if there is no handle
  90.       nHandle := FOPEN("NUL")
  91.  
  92.       /// If nHandle is -1, FOPEN() failed
  93.       IF nHandle == -1
  94.          EXIT
  95.       ENDIF
  96.  
  97.       // Store handles in an array so we can close them later
  98.       AADD( aHandles, nHandle )
  99.  
  100.    NEXT
  101.  
  102.    // nOpened has already incremented, so decrement it
  103.    nOpened--
  104.  
  105.  
  106.    FOR nClosed := 1 TO nOpened
  107.       FCLOSE( aHandles[nClosed] )
  108.    NEXT
  109.  
  110. RETURN (nOpened)
  111.  
  112.  
  113.  
  114.  
  115. // Sample usage of Handles function:
  116. PROCEDURE Test
  117.  
  118.    CLS
  119.    ? Handles()               // Total number of file handles
  120. available
  121.  
  122.    // Can we open 15 handles? (faster than opening ALL handles)
  123.    IF (Handles( 15 ) == 15)
  124.       ? "We have at least 15 file handles left..."
  125.    ENDIF
  126.  
  127. QUIT
  128.  
  129.  
  130. END: CLIPPER 5.0 SUPPORT BULLETIN #8
  131.